package api

import (
	"common"
	"context"
	"framework/msError"
	"github.com/gin-gonic/gin"
)
import "common/rpc"
import protoApi "common/proto/api"

type HelloHandler struct {
}

func NewHelloHandler() *HelloHandler {
	return &HelloHandler{}
}

/*
*
测试方法
*/
func (h *HelloHandler) Hello(c *gin.Context) {
	res, err := rpc.HelloClient.SayHello(context.Background(), &protoApi.HelloRequest{
		Name: "张三",
	})
	if err != nil {
		toError := msError.ToError(err)
		common.Fail(c, toError)
	}
	common.Success(c, res)
}
